<?php
/**
 *
 * @author Strawberry🍓
 * @date 2021-05-24 5:30 下午
 *
 */

namespace app\common\model\tang;


use app\common\impl\Comm;
use app\common\model\CommonBaseModel;



class Feedback  extends CommonBaseModel implements Comm
{
    public function getAdminPageData($param = [], $order = 'id asc')
    {
        // TODO: Implement getAdminPageData() method.
        $where=[];
        $model = self::where($where);
        if (isset($param['status'])){
            if($param['status']!=''){
                $model->where('status','=',$param['status']);
            }
        }
        if (isset($param['mobile']) && $param['mobile']){
            $model->where('mobile','like',"%{$param['mobile']}%");
        }
        $data = $model->order($order)->page(PAGE)->limit(LIMIT)->select()->toArray();
        $count = $model->count("id");
        return parent::ajaxResult($data, $count);
    }

    public function delById($id)
    {
        // TODO: Implement delById() method.
    }

    public function doAll($data)
    {
        // TODO: Implement doAll() method.
        return parent::doAllData($data);
    }

    public function doAjsx($code=0,$data = [] ,$msg = '')
    {
        // TODO: Implement doAll() method.
        return self::ajaxResult($data,0,$code,$msg);
    }

    public function details()
    {
        return $this->hasMany(FeedbackDetail::class,'pid','id')->field('id,pid,is_admin,detail,create_time');
    }
    public function back()
    {
        return $this->hasMany(FeedbackDetail::class,'pid','id')->field('id,pid,is_admin,detail,create_time');
    }

}